/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pin.db;

import java.sql.Connection;
import java.sql.SQLException;
import pin.db.connectionPool.PinDataSource;

/**
 *
 * @author huxiaodi
 */
public class ConnectionPool {

    static PinDataSource ds = null;

    public static PinDataSource getDataSource() throws SQLException {
        if (ds == null) {
            ds = new PinDataSource();
            ds.init("META-INF/dbcp.properties");
        }
        return ds;
    }

    public static Connection getConnection() throws SQLException {
        return getDataSource().getPooledConnection();
    }
}
